<?php

/**
 * Classe Categorie
 */
class Categorie {

    public $mdb2;

    /**
     * 
     * @param type $_mdb2
     */
    function __construct($_mdb2) {
        $this->mdb2 = $_mdb2;
    }

   /**
    * 
    * @return type liste des categories
    */
    public function liste() {
        $categories = array();

        $result = $this->mdb2->query("SELECT * FROM categorie ORDER BY description ASC");

        $i = 0;
        while ($row = $result->fetchRow()) {
            $categorie["id"] = $row[0];
            $categorie["description"] = $row[1];
            $categories[$i] = $categorie;

            $i++;
        }
        $result->free();

        return $categories;
    }
}

?>